//
//  MyCell.m
//  CBT
//
//  Created by Mr.Zhang on 2018/11/19.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

#import "MyCell.h"

@interface MyCell()

@property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *rightBtnRightCon;

@end

@implementation MyCell

- (void)awakeFromNib {
    [super awakeFromNib];
     self.rightBtn.hidden = YES;
}

-(void)setDataSourceDic:(NSDictionary *)dataSourceDic
{
    self.myTitleLabel.text = dataSourceDic[@"title"];
    self.myIconImageView.image = [UIImage imageNamed:dataSourceDic[@"image"]];
    
    if (self.indexRow == 5) {
        // app当前版本
        NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
        NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
        self.rightBtn.hidden  = NO;
        self.rightBtn.text    = [NSString stringWithFormat:@"V %@",app_Version];
        [self.rightBtn setTextColor:[UIColor grayColor]];
        self.rightImageView.hidden = NO;
    }
    else {
        self.rightBtn.hidden = YES;
        self.rightBtn.text   = @"";
        self.rightImageView.hidden = NO;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
